export const tableConfig = [
    { prop: "loginName", label: "账户名", minWidth: "120" },
    { prop: "showName", label: "姓名", minWidth: "100" },
    { prop: "roleName", label: "角色", minWidth: "100" },
    { prop: "deptName", label: "所属部门", minWidth: "140" },
    { prop: "state", label: "状态", minWidth: "140", slotName: "state" },
    { prop: "updateTime", label: "添加日期", minWidth: "160" },
    { label: "操作", minWidth: "240", slotName: "operate", fixed: "right" }
];
export const formConfig = [
    { formType: "input", type: "text", formName: "loginName", labelName: "账户名", placeholder: "请输入账户名/姓名" },
    {
        formType: "select",
        formName: "roleId",
        labelName: "人员角色",
        placeholder: "请选择人员角色",
        style: {
            width: "194px"
        },
        options: []
    },
    {
        formType: "select",
        formName: "deptId",
        labelName: "所属部门",
        placeholder: "请选择所属部门",
        style: {
            width: "194px"
        },
        options: []
    },
    {
        formType: "select",
        formName: "isActive",
        labelName: "角色状态",
        placeholder: "请选择角色状态",
        style: {
            width: "194px"
        },
        options: [
            {
                value: 0,
                label: "启用"
            },
            {
                value: 1,
                label: "禁用"
            }
        ]
    }
];
export const addRules = {
    loginName: [
        { required: true, message: "账户名是必填的", trigger: "blur" },
        { max: 30, message: "最大长度为30", trigger: "blur" }
    ],
    pwd: [
        {
            validator: (rule, value, callback) => {
                const passwordReg = /^.*(?=.{8,})(?=.*\d)(?=.*[A-Z])(?=.*[a-z]).*$/;
                if (!value) {
                    callback(new Error("密码是必填的"));
                } else if (!passwordReg.test(value)) {
                    callback(new Error("密码不低于8位且至少同时包含一位数字和大小写字母"));
                } else {
                    return true;
                }
            },
            trigger: "blur"
        }
    ],
    showName: [
        { required: true, message: "姓名是必填的", trigger: "blur" },
        { max: 30, message: "最大长度为30", trigger: "blur" }
    ],
    roleIds: [{ required: true, message: "角色是必选的", trigger: "change" }],
    deptId: [{ required: true, message: "部门是必选的", trigger: "change" }],
    isActive: [{ required: true, message: "状态是必选的", trigger: "change" }]
};

export const editRules = {
    loginName: [
        { required: true, message: "账户名是必填的", trigger: "blur" },
        { max: 30, message: "最大长度为30", trigger: "blur" }
    ],
    showName: [
        { required: true, message: "姓名是必填的", trigger: "blur" },
        { max: 30, message: "最大长度为30", trigger: "blur" }
    ],
    roleId: [{ required: true, message: "角色是必选的", trigger: "change" }],
    deptId: [{ required: true, message: "部门是必选的", trigger: "change" }],
    isActive: [{ required: true, message: "状态是必选的", trigger: "change" }]
};
